home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / ARCHIVE / V12N10.ZIP;1 / PATHS.ZIP / PATHS.C next >
Encoding:
C/C++ Source or Header  |  1993-03-18  |  2.1 KB  |  73 lines

  1. /*--------------------------------------
  2.    PATHS.C -- Path Operations
  3.               (c) Charles Petzold, 1993
  4.   --------------------------------------*/
  5.  
  6. #define INCL_WIN
  7. #define INCL_GPI
  8. #include <os2.h>
  9.  
  10. void PaintClient (HPS hps, SHORT cxClient, SHORT cyClient)
  11.      {
  12.      int    x, y ;
  13.      POINTL ptl ;
  14.  
  15.      for (x = 0 ; x < 3 ; x++)
  16.      for (y = 0 ; y < 2 ; y++)
  17.           {
  18.                     // Create an open sub-path
  19.  
  20.           GpiBeginPath (hps, 1) ;
  21.  
  22.           ptl.x = (1 + 10 * x) * cxClient / 30 ;
  23.           ptl.y = (4 +  5 * y) * cyClient / 10 ;
  24.           GpiMove (hps, &ptl) ;
  25.  
  26.           ptl.x = (5 + 10 * x) * cxClient / 30 ;
  27.           ptl.y = (2 +  5 * y) * cyClient / 10 ;
  28.           GpiLine (hps, &ptl) ;
  29.  
  30.           ptl.x = (9 + 10 * x) * cxClient / 30 ;
  31.           ptl.y = (4 +  5 * y) * cyClient / 10 ;
  32.           GpiLine (hps, &ptl) ;
  33.  
  34.                     // Create a closed sub-path
  35.  
  36.           ptl.x = (1 + 10 * x) * cxClient / 30 ;
  37.           ptl.y = (3 +  5 * y) * cyClient / 10 ;
  38.           GpiMove (hps, &ptl) ;
  39.  
  40.           ptl.x = (5 + 10 * x) * cxClient / 30 ;
  41.           ptl.y = (1 +  5 * y) * cyClient / 10 ;
  42.           GpiLine (hps, &ptl) ;
  43.  
  44.           ptl.x = (9 + 10 * x) * cxClient / 30 ;
  45.           ptl.y = (3 +  5 * y) * cyClient / 10 ;
  46.           GpiLine (hps, &ptl) ;
  47.  
  48.           GpiCloseFigure (hps) ;
  49.           GpiEndPath (hps) ;
  50.  
  51.                     // Possibly modify the path
  52.  
  53.           if (y == 0)
  54.                {
  55.                GpiSetLineWidthGeom (hps, cxClient / 30) ;
  56.                GpiModifyPath (hps, 1, MPATH_STROKE) ;
  57.                }
  58.  
  59.                     // Perform the operation
  60.  
  61.           GpiSetLineWidth (hps, LINEWIDTH_THICK) ;
  62.           GpiSetLineWidthGeom (hps, cxClient / 50) ;
  63.           GpiSetPattern (hps, PATSYM_HALFTONE) ;
  64.  
  65.           switch (x)
  66.                {
  67.                case 0:  GpiOutlinePath (hps, 1, 0) ;             break ;
  68.                case 1:  GpiStrokePath (hps, 1, 0) ;              break ;
  69.                case 2:  GpiFillPath (hps, 1, FPATH_ALTERNATE) ;  break ;
  70.                }
  71.           }
  72.      }
  73.